package cn.codeartist.springboot.component.http.proxy;

import cn.codeartist.springboot.component.http.bean.TypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;

/**
 * HTTP代理接口
 *
 * @author 艾江南
 * @date 2019/3/23
 */
public interface HttpProxy {

    // GET

    <T> T get(String uri, Class<T> responseType, Object... uriVariables);

    <T> T get(String uri, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T get(String uri, P request, Class<T> responseType, Object... uriVariables);

    <T, P> T get(String uri, P request, TypeReference<T> responseType, Object... uriVariables);

    // POST

    <T> T post(String uri, Class<T> responseType, Object... uriVariables);

    <T> T post(String uri, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T post(String uri, P request, Class<T> responseType, Object... uriVariables);

    <T, P> T post(String uri, P request, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T postJson(String uri, P requestBody, Class<T> responseType, Object... uriVariables);

    <T, P> T postJson(String uri, P requestBody, TypeReference<T> responseType, Object... uriVariables);

    // PUT

    <T> T put(String uri, Class<T> responseType, Object... uriVariables);

    <T> T put(String uri, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T put(String uri, P request, Class<T> responseType, Object... uriVariables);

    <T, P> T put(String uri, P request, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T putJson(String uri, P requestBody, Class<T> responseType, Object... uriVariables);

    <T, P> T putJson(String uri, P requestBody, TypeReference<T> responseType, Object... uriVariables);

    // DELETE

    <T> T delete(String uri, Class<T> responseType, Object... uriVariables);

    <T> T delete(String uri, TypeReference<T> responseType, Object... uriVariables);

    <T, P> T delete(String uri, P request, Class<T> responseType, Object... uriVariables);

    <T, P> T delete(String uri, P request, TypeReference<T> responseType, Object... uriVariables);

    // Exchange

    <T, P> T exchange(HttpMethod method, HttpHeaders headers, String uri, P requestBody, Class<T> responseType, Object... uriVariables);

    <T, P> T exchange(HttpMethod method, HttpHeaders headers, String uri, P requestBody, TypeReference<T> responseType, Object... uriVariables);
}
